<?php

namespace common\models\task;

use Yii;

/**
 * This is the model class for table "{{%task_patient}}".
 *
 * @property int $project_id 项目ID
 * @property int $task_id 任务ID
 * @property int $patient_user_id 患者ID
 * @property int $callback_id 回访ID
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class TaskPatient extends \common\models\BaseModel
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%task_patient}}';
    }

    /**
     * 指定主键
     * @return array|string[]
     */
    public static function primaryKey()
    {
        return ['task_id', 'patient_user_id'];
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['project_id', 'task_id', 'patient_user_id', 'callback_id', 'created_at', 'updated_at'], 'integer'],
            [['task_id', 'patient_user_id'], 'required'],
            [['task_id', 'patient_user_id'], 'unique', 'targetAttribute' => ['task_id', 'patient_user_id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'project_id' => '项目ID',
            'task_id' => '任务ID',
            'patient_user_id' => '患者ID',
            'callback_id' => '回访ID',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }
}
